
<?php	
	
	class order extends database
	{
		var $connection = '';	

		function order()
		{
			parent::database();
		}
	
		function GetListPaging()
		{						
			$this->setQuery("set names utf8");
			$this->query();
			return $sql = "SELECT o.*, c.* from vnf_shop_order o
            INNER JOIN vnf_customer c ON o.user_id = c.CustomerNo 
             ";					
			//return $pager;
			//$rs = $pager->paginate();
	//Loop through the result set
				
			/*$this->setQuery($sql);
			$value = $this->loadAllRow();
			return $value;*/
		}
		
		function GetList()
		{						
			$this->setQuery("set names utf8");
			$this->query();			
			$sql = "SELECT o.*, c.* from vnf_shop_order o
            INNER JOIN vnf_customer c ON o.user_id = c.CustomerNo 
             ";			
			$this->setQuery($sql);
			$value = $this->loadAllRow();
			return $value;
		}
		
		function UpdateOrder($order_status, $id)
		{
			$this->setQuery("set names utf8");
			$this->query();
			$sql = "";
			$sql = "Update vnf_shop_order set `order_status` =  '".$order_status."', `date_updated` = '".date('Y-m-d H:i:s', time())."'";
			$sql .= " where order_id=".$id;	
            //echo $sql;		
			$this->setQuery($sql);
			$this->query();
		}
		
		function GetOneOrder($id)
		{
			$this->setQuery("set names utf8");
			$this->query();
			$sql = "Select * from vnf_shop_order where order_id=".$id."";
			$this->setQuery($sql);
			$row = $this->loadOneRow();
			return $row;
		}
		
		function DeleteOrder($id)
		{
			$this->setQuery("set names utf8");
			$this->query();
			$sql = "";
			$sql = "Update vnf_shop_order set `order_status` = '0' ";
			$sql .= " where order_id=".$id;			
			
			$this->setQuery($sql);
			$this->query();
		}
	
		
	}
?>